package com.itcast.demo.direct;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author sunliang
 * @version 1.0
 * @date 2021/4/25 14:42
 */
public class TestProducer
{
    public static void main(String[] args)
    {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext-rabbitmq-producer.xml");
        RabbitTemplate rabbitTemplate = (RabbitTemplate)context.getBean("rabbitTemplate");

        rabbitTemplate.convertAndSend("", "queue.test", "直接测试模式");

        ((ClassPathXmlApplicationContext)context).close();
    }
}
